import { AutoGuideStepBase } from "./AutoGuideStepBase";
import { IAutoGuideSteper } from "./IAutoGuideSteper";
import { AutoGuideData } from "../AutoGuideData";
import { Window } from "../../../../../component/window/Window";
import { DisplayUtil } from "../../../../../common/DisplayUtil";
import { LayerManager } from "../../../../manager/LayerManager";
import { Dispatcher } from "../../../../../mvc/core/Dispatcher";
import { DataEvent } from "../../../../events/DataEvent";
import { EventName } from "../../../../mvc/EventName";
//class AutoGuideCloseWinSteper
    
    export  class AutoGuideCloseWinSteper extends AutoGuideStepBase implements IAutoGuideSteper
    {
        constructor()
        {
            super();
            return;
        }

        public guide(arg1: AutoGuideData, arg2: Window=null): void
        {
            if (arg1 == null) 
            {
                return;
            }
            if (arg2 == null) 
            {
                arg2 = DisplayUtil.getChildByPropety(LayerManager.windowLayer, "winTitleName", arg1.guideTypeValue) as Window;
            }
            if (arg2 == null) 
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.AutoGuideDelDoingRecord, arg1));
                return;
            }
            arg2.hide();
            Dispatcher.dispatchEvent(new DataEvent(EventName.AutoGuideStepEnd, arg1));
            return;
        }

        public stop(arg1: AutoGuideData=null): void
        {
            return;
        }
    }
